<?php
if (!empty($_POST))
{
    date_default_timezone_set('PRC');//
    $t=time();
    $today=date('Y-m-d H:i:s',$t);
    include"conn.php";
    $name=$_POST['name']; 
    $content=$_POST['content'];
    $sql="insert into  notes(name,content,addtime) value('$name','$content','$today')";
    $rs=$mylink->query($sql);//$rs如果成功，rs为真   如果失败   rs为假  
    $sql="select max(id) as id from  notes";
    $rs=$mylink->query($sql);//$rs如果成功，rs为真   如果失败   rs为假 
    $row=$rs->fetch_array();
    $id=$row['id'];
    $r=array('name'=>"$name",'content'=>"$content","time"=>"$today","id"=>"$id");
    echo json_encode($r);  //假如有数据POST过来
    die;
}

$data=array("name"=>"abc","content"=>"123456");   //没有数据POST过来
echo json_encode($data);